<?php
function getProductID($type){
	$result = "";
	switch ($type){
		case 'bed': $result.="1"; break;
		case 'doll': $result.="2"; break;
		case 'etc': $result.="3"; break;
	}
	$result.=date("mdy");
	//echo $result;
	
	include 'dbconnect.php';
	$strSQL = "SELECT count(*) as countp FROM dk_product WHERE productID LIKE '$result%'";
	
	//echo $strSQL;
	
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	$data = mysql_fetch_array($objQuery);
	$id=$data['countp']+1;
	if ($id<10)
	{
		$id="0".$id;
	}
	$result.=$id;
	return $result;
}

function printCheckField() {
	$noField=$_GET['noItem'];
	
	for ($i=0;$i<$noField;$i++)
	{
		echo '<tr>';
		echo "<td><input type='text' id='pname".$i."' name='pname".$i."'/></td>";
		echo "<td><input type='text' id='quan".$i."' name='quan".$i."'/></td>";
		echo "<td><input type='text' id='price".$i."' name='price".$i."'/></td>";
		echo "<td><input type='text' id='sum".$i."' name='sum".$i."'/></td>";
		echo '</tr>';
	}
}

function findUnit($pgroup){
	switch ($pgroup)
	{
		case 'bed' : return "หลัง"; break;
		case 'doll' : return "ตัว"; break;
		default: return "";
	}
}

?>